﻿using System;
using System.Collections.Generic;
using System.Linq;
using BingleMaps.Models;

namespace BingleMaps.Extensions
{
	public static class UserPinExtensions
	{
		public static UserPin GetUserPin(this IEnumerable<UserPin> source, Guid key)
		{
			return source.FirstOrDefault(pin => pin.Key == key);
		}

		public static bool Equals(UserPin pin1, UserPin pin2)
		{
			return pin1 == pin2 || (pin1 != null && pin2 != null && pin1.Key == pin2.Key);
		}
	}
}
